name = "cargo"
version = "0.1.0"
dependencies = [
- "curl 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
- "docopt 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)",
- "flate2 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "git2 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "glob 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "curl 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
+ "docopt 0.6.22 (registry+https://github.com/rust-lang/crates.io-index)",
+ "flate2 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "git2 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
+ "glob 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"hamcrest 0.1.0 (git+https://github.com/carllerche/hamcrest-rust.git)",
- "log 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "log 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"registry 0.1.0",
- "rustc-serialize 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "semver 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
- "tar 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "term 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "time 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "toml 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
- "url 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-serialize 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
+ "semver 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
+ "tar 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "term 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "time 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
+ "toml 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
+ "url 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "curl"
-version = "0.1.4"
+version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "curl-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "url 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
+ "curl-sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "url 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "curl-sys"
-version = "0.1.2"
+version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libz-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "openssl-sys 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
- "pkg-config 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "openssl-sys 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
+ "pkg-config 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "docopt"
-version = "0.6.21"
+version = "0.6.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "regex 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-serialize 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "regex 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-serialize 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "flate2"
-version = "0.1.1"
+version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"miniz-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
[[package]]
name = "gcc"
-version = "0.1.2"
+version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "git2"
-version = "0.1.5"
+version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "libgit2-sys 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
- "time 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "url 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libgit2-sys 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "time 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
+ "url 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "glob"
-version = "0.1.3"
+version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
[[package]]
name = "libgit2-sys"
-version = "0.1.4"
+version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "libssh2-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "openssl-sys 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
- "pkg-config 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libssh2-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "openssl-sys 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
+ "pkg-config 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "libressl-pnacl-sys"
-version = "2.1.0"
+version = "2.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "pnacl-build-helper 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "pnacl-build-helper 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "libssh2-sys"
-version = "0.1.0"
+version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libz-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "openssl-sys 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
- "pkg-config 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "openssl-sys 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
+ "pkg-config 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "pkg-config 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "pkg-config 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "log"
-version = "0.1.5"
+version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "regex 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "regex 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "gcc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gcc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "openssl-sys"
-version = "0.2.10"
+version = "0.2.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "libressl-pnacl-sys 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "pkg-config 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libressl-pnacl-sys 2.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "pkg-config 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "pkg-config"
-version = "0.1.2"
+version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "pnacl-build-helper"
-version = "1.0.0"
+version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "regex"
-version = "0.1.5"
+version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "registry"
version = "0.1.0"
dependencies = [
- "curl 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-serialize 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "curl 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-serialize 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rustc-serialize"
-version = "0.1.5"
+version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "semver"
-version = "0.1.7"
+version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "tar"
-version = "0.1.3"
+version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "term"
-version = "0.1.1"
+version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "log 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "log 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "time"
-version = "0.1.5"
+version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "gcc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gcc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "toml"
-version = "0.1.7"
+version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "rustc-serialize 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-serialize 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "url"
-version = "0.2.9"
+version = "0.2.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "rustc-serialize 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-serialize 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
path = "src/cargo/lib.rs"
[dependencies]
-toml = "0.1.7"
-semver = "0.1.6"
-curl = "0.1.3"
-tar = "0.1.3"
-flate2 = "0.1.0"
-git2 = "0.1.0"
-glob = "0.1.0"
-time = "0.1.0"
-log = "0.1.0"
-docopt = "0.6.19"
-url = "0.2.7"
-rustc-serialize = "0.1.5"
+toml = "0.1"
+semver = "0.1"
+curl = "0.1"
+tar = "0.1"
+flate2 = "0.1"
+git2 = "0.1"
+glob = "0.1"
+time = "0.1"
+log = "0.1"
+docopt = "0.6"
+url = "0.2"
+rustc-serialize = "0.2"
term = "0.1"
[dev-dependencies.hamcrest]
use cargo::util::{CliResult, CliError, Human};
use cargo::util::important_paths::{find_root_manifest_for_cwd};
-#[deriving(RustcDecodable)]
+#[derive(RustcDecodable)]
struct Options {
flag_no_run: bool,
flag_package: Option<String>,
use cargo::util::important_paths::{find_root_manifest_for_cwd};
use cargo::util::{CliResult, CliError};
-#[deriving(RustcDecodable)]
+#[derive(RustcDecodable)]
struct Options {
flag_package: Option<String>,
flag_jobs: Option<uint>,
-#![feature(phase, macro_rules)]
+#![feature(phase, macro_rules, old_orphan_check)]
extern crate "rustc-serialize" as rustc_serialize;
#[phase(plugin, link)] extern crate log;
use std::collections::BTreeSet;
use std::os;
use std::io;
-use std::io::fs::{mod, PathExtensions};
+use std::io::fs::{self, PathExtensions};
use std::io::process::{Command,InheritFd,ExitStatus,ExitSignal};
use cargo::{execute_main_without_stdin, handle_error, shell};
use cargo::core::MultiShell;
use cargo::util::{CliError, CliResult, lev_distance};
-#[deriving(RustcDecodable)]
+#[derive(RustcDecodable)]
struct Flags {
flag_list: bool,
flag_verbose: bool,
use cargo::util::{CliResult, CliError};
use cargo::util::important_paths::{find_root_manifest_for_cwd};
-#[deriving(RustcDecodable)]
+#[derive(RustcDecodable)]
struct Options {
flag_package: Option<String>,
flag_target: Option<String>,
use cargo::core::MultiShell;
use cargo::util::{CliResult, CliError, config};
-#[deriving(RustcDecodable)]
+#[derive(RustcDecodable)]
struct ConfigForKeyFlags {
flag_human: bool,
flag_key: String,
}
-#[deriving(RustcEncodable)]
+#[derive(RustcEncodable)]
struct ConfigOut {
values: HashMap<String, config::ConfigValue>
}
use cargo::core::MultiShell;
use cargo::util::{CliResult, CliError, config};
-#[deriving(RustcDecodable)]
+#[derive(RustcDecodable)]
struct ConfigListFlags {
flag_human: bool,
}
-#[deriving(RustcEncodable)]
+#[derive(RustcEncodable)]
struct ConfigOut {
values: HashMap<String, config::ConfigValue>
}
use cargo::util::{CliResult, CliError};
use cargo::util::important_paths::{find_root_manifest_for_cwd};
-#[deriving(RustcDecodable)]
+#[derive(RustcDecodable)]
struct Options {
flag_features: Vec<String>,
flag_jobs: Option<uint>,
use cargo::util::{CliResult, CliError};
use cargo::util::important_paths::find_root_manifest_for_cwd;
-#[deriving(RustcDecodable)]
+#[derive(RustcDecodable)]
struct Options {
flag_manifest_path: Option<String>,
flag_verbose: bool,
use cargo::util::{CliResult, CliError};
use cargo::util::important_paths::find_root_manifest_for_cwd;
-#[deriving(RustcDecodable)]
+#[derive(RustcDecodable)]
struct Options {
flag_manifest_path: Option<String>,
flag_verbose: bool,
use cargo::sources::git::{GitSource};
use cargo::util::{Config, CliResult, CliError, human, ToUrl};
-#[deriving(RustcDecodable)]
+#[derive(RustcDecodable)]
struct Options {
flag_url: String,
flag_reference: String,
use cargo::core::MultiShell;
use cargo::util::{CliResult, CliError};
-#[deriving(RustcDecodable)]
+#[derive(RustcDecodable)]
struct Options;
pub const USAGE: &'static str = "
use cargo::util::{CliResult, CliError, human, ChainError};
use cargo::util::important_paths::{find_root_manifest_for_cwd};
-#[deriving(RustcDecodable)]
+#[derive(RustcDecodable)]
struct LocateProjectFlags {
flag_manifest_path: Option<String>,
}
-h, --help Print this message
";
-#[deriving(RustcEncodable)]
+#[derive(RustcEncodable)]
struct ProjectLocation {
root: String
}
use cargo::sources::RegistrySource;
use cargo::util::{CliResult, CliError, Config};
-#[deriving(RustcDecodable)]
+#[derive(RustcDecodable)]
struct Options {
flag_host: Option<String>,
arg_token: Option<String>,
use cargo::core::MultiShell;
use cargo::util::{CliResult, CliError};
-#[deriving(RustcDecodable)]
+#[derive(RustcDecodable)]
struct Options {
flag_verbose: bool,
flag_bin: bool,
use cargo::core::MultiShell;
use cargo::util::{CliResult, CliError};
-#[deriving(RustcDecodable)]
+#[derive(RustcDecodable)]
struct Options {
arg_crate: Option<String>,
flag_token: Option<String>,
use cargo::util::{CliResult, CliError};
use cargo::util::important_paths::find_root_manifest_for_cwd;
-#[deriving(RustcDecodable)]
+#[derive(RustcDecodable)]
struct Options {
flag_verbose: bool,
flag_manifest_path: Option<String>,
use cargo::util::{CliResult, CliError};
use cargo::util::important_paths::{find_root_manifest_for_cwd};
-#[deriving(RustcDecodable)]
+#[derive(RustcDecodable)]
struct Options {
flag_verbose: bool,
flag_manifest_path: Option<String>,
use cargo::util::{CliResult, CliError};
use cargo::util::important_paths::find_root_manifest_for_cwd;
-#[deriving(RustcDecodable)]
+#[derive(RustcDecodable)]
struct Options {
flag_host: Option<String>,
flag_token: Option<String>,
use cargo::util::{CliResult, CliError};
use cargo::sources::{PathSource};
-#[deriving(RustcDecodable)]
+#[derive(RustcDecodable)]
struct Options {
flag_manifest_path: String,
}
use cargo::util::{CliResult, CliError, human};
use cargo::util::important_paths::{find_root_manifest_for_cwd};
-#[deriving(RustcDecodable)]
+#[derive(RustcDecodable)]
struct Options {
flag_bin: Option<String>,
flag_example: Option<String>,
use cargo::core::{MultiShell};
use cargo::util::{CliResult, CliError};
-#[deriving(RustcDecodable)]
+#[derive(RustcDecodable)]
struct Options {
flag_host: Option<String>,
flag_verbose: bool,
use cargo::util::{CliResult, CliError, Human};
use cargo::util::important_paths::{find_root_manifest_for_cwd};
-#[deriving(RustcDecodable)]
+#[derive(RustcDecodable)]
struct Options {
arg_args: Vec<String>,
flag_features: Vec<String>,
use cargo::util::{CliResult, CliError};
use cargo::util::important_paths::find_root_manifest_for_cwd;
-#[deriving(RustcDecodable)]
+#[derive(RustcDecodable)]
struct Options {
arg_spec: Option<String>,
flag_package: Option<String>,
pub type Error = HashMap<String, String>;
-#[deriving(RustcDecodable)]
+#[derive(RustcDecodable)]
struct Flags {
flag_manifest_path: String,
flag_verbose: bool,
use cargo::core::MultiShell;
use cargo::util::CliResult;
-#[deriving(RustcDecodable)]
+#[derive(RustcDecodable)]
struct Options;
pub const USAGE: &'static str = "
use cargo::util::{CliResult, CliError};
use cargo::util::important_paths::find_root_manifest_for_cwd;
-#[deriving(RustcDecodable)]
+#[derive(RustcDecodable)]
struct Options {
arg_crate: Option<String>,
flag_token: Option<String>,
use util::CargoResult;
/// Informations about a dependency requested by a Cargo manifest.
-#[deriving(PartialEq,Clone,Show)]
+#[derive(PartialEq,Clone,Show)]
pub struct Dependency {
name: String,
source_id: SourceId,
only_for_platform: Option<String>,
}
-#[deriving(PartialEq, Clone, Show, Copy)]
+#[derive(PartialEq, Clone, Show, Copy)]
pub enum Kind {
Normal,
Development,
}
}
-#[deriving(PartialEq,Clone,RustcEncodable)]
+#[derive(PartialEq,Clone,RustcEncodable)]
pub struct SerializedDependency {
name: String,
req: String
use std::hash;
-use std::fmt::{mod, Show, Formatter};
+use std::fmt::{self, Show, Formatter};
use semver::Version;
use rustc_serialize::{Encoder,Encodable};
use util::{CargoResult, human};
/// Contains all the informations about a package, as loaded from a Cargo.toml.
-#[deriving(PartialEq,Clone)]
+#[derive(PartialEq,Clone)]
pub struct Manifest {
summary: Summary,
targets: Vec<Target>,
/// validated by cargo itself, but rather it is up to the registry when uploaded
/// to validate these fields. Cargo will itself accept any valid TOML
/// specification for these values.
-#[deriving(PartialEq, Clone)]
+#[derive(PartialEq, Clone)]
pub struct ManifestMetadata {
pub authors: Vec<String>,
pub keywords: Vec<String>,
pub documentation: Option<String>, // url
}
-#[deriving(PartialEq,Clone,RustcEncodable)]
+#[derive(PartialEq,Clone,RustcEncodable)]
pub struct SerializedManifest {
name: String,
version: String,
}
}
-#[deriving(Show, Clone, PartialEq, Hash, RustcEncodable, Copy)]
+#[derive(Show, Clone, PartialEq, Hash, RustcEncodable, Copy)]
pub enum LibKind {
Lib,
Rlib,
}
}
-#[deriving(Show, Clone, Hash, PartialEq, RustcEncodable)]
+#[derive(Show, Clone, Hash, PartialEq, RustcEncodable)]
pub enum TargetKind {
Lib(Vec<LibKind>),
Bin,
Example,
}
-#[deriving(RustcEncodable, RustcDecodable, Clone, PartialEq, Show)]
+#[derive(RustcEncodable, RustcDecodable, Clone, PartialEq, Show)]
pub struct Profile {
env: String, // compile, test, dev, bench, etc.
opt_level: uint,
}
/// Informations about a binary, a library, an example, etc. that is part of the package.
-#[deriving(Clone, Hash, PartialEq)]
+#[derive(Clone, Hash, PartialEq)]
pub struct Target {
kind: TargetKind,
name: String,
metadata: Option<Metadata>,
}
-#[deriving(RustcEncodable)]
+#[derive(RustcEncodable)]
pub struct SerializedTarget {
kind: Vec<&'static str>,
name: String,
-use std::fmt::{mod, Show, Formatter};
+use std::fmt::{self, Show, Formatter};
use std::hash;
use std::slice;
use semver::Version;
///
/// A package is a `Cargo.toml` file, plus all the files that are part of it.
// TODO: Is manifest_path a relic?
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct Package {
// The package's manifest
manifest: Manifest,
source_id: SourceId,
}
-#[deriving(RustcEncodable)]
+#[derive(RustcEncodable)]
struct SerializedPackage {
name: String,
version: String,
}
}
-#[deriving(PartialEq,Clone,Show)]
+#[derive(PartialEq,Clone,Show)]
pub struct PackageSet {
packages: Vec<Package>,
}
-use semver;
+use std::cmp::Ordering;
use std::error::{Error, FromError};
+use std::fmt::{self, Show, Formatter};
use std::hash::Hash;
-use std::sync::Arc;
-use std::fmt::{mod, Show, Formatter};
use std::hash;
-use rustc_serialize::{Encodable, Encoder, Decodable, Decoder};
+use std::sync::Arc;
use regex::Regex;
+use rustc_serialize::{Encodable, Encoder, Decodable, Decoder};
+use semver;
use util::{CargoResult, CargoError, short_hash, ToSemver};
use core::source::SourceId;
/// Identifier for a specific version of a package in a specific source.
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct PackageId {
inner: Arc<PackageIdInner>,
}
-#[deriving(PartialEq, PartialOrd, Eq, Ord)]
+#[derive(PartialEq, PartialOrd, Eq, Ord)]
struct PackageIdInner {
name: String,
version: semver::Version,
}
}
-#[deriving(Clone, Show, PartialEq)]
+#[derive(Clone, Show, PartialEq)]
pub enum PackageIdError {
InvalidVersion(String),
InvalidNamespace(String)
fn from_error(t: PackageIdError) -> Box<CargoError> { box t }
}
-#[deriving(PartialEq, Hash, Clone, RustcEncodable)]
+#[derive(PartialEq, Hash, Clone, RustcEncodable)]
pub struct Metadata {
pub metadata: String,
pub extra_filename: String
use std::fmt;
use semver::Version;
-use url::{mod, Url, UrlParser};
+use url::{self, Url, UrlParser};
use core::PackageId;
use util::{CargoResult, ToUrl, human, ToSemver, ChainError};
-#[deriving(Clone, PartialEq, Eq)]
+#[derive(Clone, PartialEq, Eq)]
pub struct PackageIdSpec {
name: String,
version: Option<Version>,
locked: HashMap<SourceId, HashMap<String, Vec<(PackageId, Vec<PackageId>)>>>,
}
-#[deriving(PartialEq, Eq, Copy)]
+#[derive(PartialEq, Eq, Copy)]
enum Kind {
Override,
Locked,
}
pub fn register_lock(&mut self, id: PackageId, deps: Vec<PackageId>) {
- let sub_map = match self.locked.entry(id.get_source_id().clone()) {
+ let source = id.get_source_id().clone();
+ let sub_map = match self.locked.entry(&source) {
Occupied(e) => e.into_mut(),
- Vacant(e) => e.set(HashMap::new()),
+ Vacant(e) => e.insert(HashMap::new()),
};
- let sub_vec = match sub_map.entry(id.get_name().to_string()) {
+ let name = id.get_name().to_string();
+ let sub_vec = match sub_map.entry(&name) {
Occupied(e) => e.into_mut(),
- Vacant(e) => e.set(Vec::new()),
+ Vacant(e) => e.insert(Vec::new()),
};
sub_vec.push((id, deps));
}
use super::Resolve;
-#[deriving(RustcEncodable, RustcDecodable, Show)]
+#[derive(RustcEncodable, RustcDecodable, Show)]
pub struct EncodableResolve {
package: Option<Vec<EncodableDependency>>,
root: EncodableDependency,
}
}
-#[deriving(RustcEncodable, RustcDecodable, Show, PartialOrd, Ord, PartialEq, Eq)]
+#[derive(RustcEncodable, RustcDecodable, Show, PartialOrd, Ord, PartialEq, Eq)]
pub struct EncodableDependency {
name: String,
version: String,
}
}
-#[deriving(Show, PartialOrd, Ord, PartialEq, Eq)]
+#[derive(Show, PartialOrd, Ord, PartialEq, Eq)]
pub struct EncodablePackageId {
name: String,
version: String,
///
/// Each instance of `Resolve` also understands the full set of features used
/// for each package as well as what the root package is.
-#[deriving(PartialEq, Eq, Clone)]
+#[derive(PartialEq, Eq, Clone)]
pub struct Resolve {
graph: Graph<PackageId>,
features: HashMap<PackageId, HashSet<String>>,
metadata: Option<Metadata>,
}
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum Method<'a> {
Everything,
Required(/* dev_deps = */ bool,
spec: &PackageIdSpec) {
let mut version_cnt = HashMap::new();
for id in ids.iter() {
- let slot = match version_cnt.entry(id.get_version()) {
- Occupied(e) => e.into_mut(),
- Vacant(e) => e.set(0u),
- };
- *slot += 1;
+ match version_cnt.entry(&id.get_version()) {
+ Vacant(e) => { e.insert(1u); }
+ Occupied(e) => *e.into_mut() += 1u,
+ }
}
for id in ids.iter() {
if version_cnt[id.get_version()] == 1 {
}
}
-#[deriving(Clone)]
+#[derive(Clone)]
struct Context {
activations: HashMap<(String, SourceId), Vec<Rc<Summary>>>,
resolve: Resolve,
let early_return = {
my_cx.resolve.graph.link(parent.get_package_id().clone(),
candidate.get_package_id().clone());
- let prev = match my_cx.activations.entry(key.clone()) {
+ let prev = match my_cx.activations.entry(&key) {
Occupied(e) => e.into_mut(),
- Vacant(e) => e.set(Vec::new()),
+ Vacant(e) => e.insert(Vec::new()),
};
if prev.iter().any(|c| c == candidate) {
match cx.resolve.features(candidate.get_package_id()) {
// Record what list of features is active for this package.
if used_features.len() > 0 {
- let pkgid = parent.get_package_id().clone();
+ let pkgid = parent.get_package_id();
match cx.resolve.features.entry(pkgid) {
Occupied(entry) => entry.into_mut(),
- Vacant(entry) => entry.set(HashSet::new()),
+ Vacant(entry) => entry.insert(HashSet::new()),
}.extend(used_features.into_iter());
}
match parts.next() {
Some(feat) => {
let package = feat_or_package;
- match deps.entry(package.to_string()) {
+ match deps.entry(package) {
Occupied(e) => e.into_mut(),
- Vacant(e) => e.set(Vec::new()),
+ Vacant(e) => e.insert(Vec::new()),
}.push(feat.to_string());
}
None => {
}
}
None => {
- match deps.entry(feat.to_string()) {
+ match deps.entry(feat) {
Occupied(..) => {} // already activated
- Vacant(e) => { e.set(Vec::new()); }
+ Vacant(e) => { e.insert(Vec::new()); }
}
}
}
use self::AdequateTerminal::{NoColor, Colored};
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct ShellConfig {
pub color: bool,
pub verbose: bool,
use std::collections::hash_map::{HashMap, Values, IterMut};
-use std::fmt::{mod, Show, Formatter};
+use std::cmp::Ordering;
+use std::fmt::{self, Show, Formatter};
use std::hash;
use std::mem;
use std::sync::Arc;
fn fingerprint(&self, pkg: &Package) -> CargoResult<String>;
}
-#[deriving(Show, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
+#[derive(Show, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
enum Kind {
/// Kind::Git(<git reference>) represents a git repository
Git(GitReference),
Registry,
}
-#[deriving(Show, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
+#[derive(Show, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum GitReference {
Tag(String),
Branch(String),
type Error = Box<CargoError + Send>;
/// Unique identifier for a source of packages.
-#[deriving(Clone, Eq)]
+#[derive(Clone, Eq)]
pub struct SourceId {
inner: Arc<SourceIdInner>,
}
-#[deriving(Eq, Clone)]
+#[derive(Eq, Clone)]
struct SourceIdInner {
url: Url,
kind: Kind,
}
}
-impl<'a, 'src> Iterator<(&'a SourceId, &'a mut (Source + 'src))>
- for SourcesMut<'a, 'src>
-{
+impl<'a, 'src> Iterator for SourcesMut<'a, 'src> {
+ type Item = (&'a SourceId, &'a mut (Source + 'src));
fn next(&mut self) -> Option<(&'a SourceId, &'a mut (Source + 'src))> {
self.inner.next().map(|(a, b)| (a, &mut **b))
}
/// a package.
///
/// Summaries are cloned, and should not be mutated after creation
-#[deriving(Show,Clone)]
+#[derive(Show,Clone)]
pub struct Summary {
package_id: PackageId,
dependencies: Vec<Dependency>,
#![crate_type="rlib"]
#![feature(macro_rules, phase, default_type_params, unboxed_closures)]
-#![feature(slicing_syntax)]
+#![feature(slicing_syntax, old_orphan_check, associated_types)]
#![deny(unused)]
#![cfg_attr(test, deny(warnings))]
extern crate registry;
-use std::os;
use std::error::Error;
+use std::fmt;
use std::io::stdio::{stdout_raw, stderr_raw};
-use std::io::{mod, stdout, stderr};
+use std::io::{self, stdout, stderr};
+use std::os;
use rustc_serialize::{Decoder, Encoder, Decodable, Encodable};
-use rustc_serialize::json;
+use rustc_serialize::json::{self, Json};
use docopt::Docopt;
use core::{Shell, MultiShell, ShellConfig};
pub trait RepresentsJSON : Decodable<json::Decoder, json::DecoderError> {}
impl<T: Decodable<json::Decoder, json::DecoderError>> RepresentsJSON for T {}
-pub fn execute_main<'a,
- T: Decodable<docopt::Decoder, docopt::Error>,
- U: RepresentsJSON,
- V: Encodable<json::Encoder<'a>, io::IoError>>(
+pub fn execute_main<T, U, V>(
exec: fn(T, U, &mut MultiShell) -> CliResult<Option<V>>,
options_first: bool,
- usage: &str) {
+ usage: &str)
+ where V: for<'a> Encodable<json::Encoder<'a>, fmt::Error>,
+ T: Decodable<docopt::Decoder, docopt::Error>,
+ U: RepresentsJSON
+{
process::<V>(|rest, shell| call_main(exec, shell, usage, rest, options_first));
}
-pub fn call_main<'a,
- T: Decodable<docopt::Decoder, docopt::Error>,
- U: RepresentsJSON,
- V: Encodable<json::Encoder<'a>, io::IoError>>(
+pub fn call_main<T, U, V>(
exec: fn(T, U, &mut MultiShell) -> CliResult<Option<V>>,
shell: &mut MultiShell,
usage: &str,
args: &[String],
- options_first: bool) -> CliResult<Option<V>> {
+ options_first: bool) -> CliResult<Option<V>>
+ where V: for<'a> Encodable<json::Encoder<'a>, fmt::Error>,
+ T: Decodable<docopt::Decoder, docopt::Error>,
+ U: RepresentsJSON
+{
let flags = try!(flags_from_args::<T>(usage, args, options_first));
let json = try!(json_from_stdin::<U>());
exec(flags, json, shell)
}
-pub fn execute_main_without_stdin<'a,
- T: Decodable<docopt::Decoder, docopt::Error>,
- V: Encodable<json::Encoder<'a>, io::IoError>>(
+pub fn execute_main_without_stdin<T, V>(
exec: fn(T, &mut MultiShell) -> CliResult<Option<V>>,
options_first: bool,
- usage: &str) {
+ usage: &str)
+ where V: for<'a> Encodable<json::Encoder<'a>, fmt::Error>,
+ T: Decodable<docopt::Decoder, docopt::Error>
+{
process::<V>(|rest, shell| call_main_without_stdin(exec, shell, usage, rest,
options_first));
}
-pub fn execute_main_with_args_and_without_stdin<'a,
- T: Decodable<docopt::Decoder, docopt::Error>,
- V: Encodable<json::Encoder<'a>, io::IoError>>(
+pub fn execute_main_with_args_and_without_stdin<T, V>(
exec: fn(T, &mut MultiShell) -> CliResult<Option<V>>,
options_first: bool,
usage: &str,
- args: &[String]) {
+ args: &[String])
+ where V: for<'a> Encodable<json::Encoder<'a>, fmt::Error>,
+ T: Decodable<docopt::Decoder, docopt::Error>
+{
let mut shell = shell(true);
process_executed(
&mut shell)
}
-pub fn call_main_without_stdin<'a,
- T: Decodable<docopt::Decoder, docopt::Error>,
- V: Encodable<json::Encoder<'a>, io::IoError>>(
+pub fn call_main_without_stdin<T, V>(
exec: fn(T, &mut MultiShell) -> CliResult<Option<V>>,
shell: &mut MultiShell,
usage: &str,
args: &[String],
- options_first: bool) -> CliResult<Option<V>> {
+ options_first: bool) -> CliResult<Option<V>>
+ where V: for<'a> Encodable<json::Encoder<'a>, fmt::Error>,
+ T: Decodable<docopt::Decoder, docopt::Error>
+{
let flags = try!(flags_from_args::<T>(usage, args, options_first));
exec(flags, shell)
}
-fn process<'a, V: Encodable<json::Encoder<'a>, io::IoError>>(
- callback: |&[String], &mut MultiShell| -> CliResult<Option<V>>) {
+fn process<V>(callback: |&[String], &mut MultiShell| -> CliResult<Option<V>>)
+ where V: for<'a> Encodable<json::Encoder<'a>, fmt::Error>
+{
let mut shell = shell(true);
process_executed(callback(os::args().as_slice(), &mut shell), &mut shell)
}
-pub fn process_executed<'a,
- T: Encodable<json::Encoder<'a>, io::IoError>>(
- result: CliResult<Option<T>>,
- shell: &mut MultiShell) {
+pub fn process_executed<T>(result: CliResult<Option<T>>,
+ shell: &mut MultiShell)
+ where T: for<'a> Encodable<json::Encoder<'a>, fmt::Error>
+{
match result {
Err(e) => handle_error(e, shell),
Ok(Some(encodable)) => {
CliError::new("Standard in did not exist or was not UTF-8", 1)
}));
- let json = try!(json::from_str(input.as_slice()).map_err(|_| {
+ let json = try!(Json::from_str(input.as_slice()).map_err(|_| {
CliError::new("Could not parse standard in as JSON", 1)
}));
let mut decoder = json::Decoder::new(json);
use std::default::Default;
-use std::io::fs::{mod, PathExtensions};
+use std::io::fs::{self, PathExtensions};
use core::{MultiShell, PackageSet};
use core::source::{Source, SourceMap};
use sources::PathSource;
use util::{CargoResult, human, ChainError, Config};
-use ops::{mod, Layout, Context};
+use ops::{self, Layout, Context};
pub struct CleanOptions<'a> {
pub spec: Option<&'a str>,
use core::registry::PackageRegistry;
use core::{MultiShell, Source, SourceId, PackageSet, Package, Target, PackageId};
use core::resolver::Method;
-use ops::{mod, BuildOutput, ExecEngine};
+use ops::{self, BuildOutput, ExecEngine};
use sources::{PathSource};
use util::config::{Config, ConfigValue};
use util::{CargoResult, config, internal, human, ChainError, profile};
use std::os;
-use std::io::{mod, fs, File};
+use std::io::{self, fs, File};
use std::io::fs::PathExtensions;
use git2::Config;
use std::collections::HashSet;
-use std::io::{mod, File, fs};
+use std::io::{self, File, fs};
use std::io::fs::PathExtensions;
use core::{Package,Manifest,SourceId};
-use util::{mod, CargoResult, human};
+use util::{self, CargoResult, human};
use util::important_paths::find_project_manifest_exact;
use util::toml::{Layout, project_layout};
use std::error::FromError;
use std::os;
-use ops::{mod, ExecEngine};
+use ops::{self, ExecEngine};
use util::{CargoResult, human, process, ProcessError, ChainError};
use core::manifest::TargetKind;
use core::source::Source;
use std::collections::HashMap;
+use std::c_str::ToCStr;
use std::dynamic_lib::DynamicLibrary;
use semver::Version;
use core::{PackageId, Package};
-use util::{mod, CargoResult};
+use util::{self, CargoResult};
use super::{CommandType, CommandPrototype};
use std::sync::Arc;
use core::{SourceMap, Package, PackageId, PackageSet, Resolve, Target};
-use util::{mod, CargoResult, ChainError, internal, Config, profile};
+use util::{self, CargoResult, ChainError, internal, Config, profile};
use util::human;
use super::{Kind, Compilation, BuildConfig};
use super::custom_build::BuildState;
use super::{ProcessEngine, ExecEngine};
-#[deriving(Show, Copy)]
+#[derive(Show, Copy)]
pub enum Platform {
Target,
Plugin,
req: Platform) {
let req = if target.get_profile().is_for_host() {Platform::Plugin} else {req};
- match self.requirements.entry((pkg.get_package_id(), target.get_name())) {
+ match self.requirements.entry(&(pkg.get_package_id(), target.get_name())) {
Occupied(mut entry) => match (*entry.get(), req) {
(Platform::Plugin, Platform::Plugin) |
(Platform::PluginAndTarget, Platform::Plugin) |
(Platform::PluginAndTarget, Platform::PluginAndTarget) => return,
_ => *entry.get_mut() = entry.get().combine(req),
},
- Vacant(entry) => { entry.set(req); }
+ Vacant(entry) => { entry.insert(req); }
};
for &(pkg, dep) in self.dep_targets(pkg, target).iter() {
+use std::c_str::ToCStr;
use std::collections::HashMap;
use std::fmt;
use std::io::fs::PathExtensions;
use std::io::{fs, USER_RWX, File};
use std::str;
use std::sync::Mutex;
+use std::sync::mpsc::Sender;
use core::{Package, Target, PackageId, PackageSet};
use util::{CargoResult, human, Human};
use util::Freshness;
/// Contains the parsed output of a custom build script.
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct BuildOutput {
/// Paths to pass to rustc with the `-L` flag
pub library_paths: Vec<Path>,
}
// And now finally, run the build command itself!
- desc_tx.send_opt(p.to_string()).ok();
+ desc_tx.send(p.to_string()).ok();
let output = try!(exec_engine.exec_with_output(p).map_err(|mut e| {
e.desc = format!("failed to run custom build command for `{}`\n{}",
pkg_name, e.desc);
// Also note that a fresh build command needs to
let (freshness, dirty, fresh) =
try!(fingerprint::prepare_build_cmd(cx, pkg, Some(target)));
- let dirty = Work::new(move |tx: Sender<String>| {
+ let dirty = Work::new(move |tx| {
try!(work(tx.clone()));
dirty.call(tx)
});
use std::collections::HashMap;
-use std::c_str::CString;
+use std::c_str::{CString, ToCStr};
use std::io::process::ProcessOutput;
-use std::fmt::{mod, Show, Formatter};
+use std::fmt::{self, Show, Formatter};
-use util::{mod, CargoResult, ProcessError, ProcessBuilder};
+use util::{self, CargoResult, ProcessError, ProcessBuilder};
/// Trait for objects that can execute commands.
pub trait ExecEngine: Send + Sync {
}
/// Default implementation of `ExecEngine`.
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct ProcessEngine;
impl ExecEngine for ProcessEngine {
}
/// Prototype for a command that must be executed.
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct CommandPrototype {
ty: CommandType,
args: Vec<CString>,
}
}
-#[deriving(Clone, Show)]
+#[derive(Clone, Show)]
pub enum CommandType {
Rustc,
Rustdoc,
use std::collections::hash_map::Entry::{Occupied, Vacant};
use std::hash::{Hash, Hasher};
use std::hash::sip::SipHasher;
-use std::io::{mod, fs, File, BufferedReader};
+use std::io::{self, fs, File, BufferedReader};
use std::io::fs::PathExtensions;
use core::{Package, Target};
} else if target.is_bin() {
cx.compilation.binaries.push(dst);
} else if target.is_lib() {
- let pkgid = pkg.get_package_id().clone();
+ let pkgid = pkg.get_package_id();
match cx.compilation.libraries.entry(pkgid) {
Occupied(entry) => entry.into_mut(),
- Vacant(entry) => entry.set(Vec::new()),
+ Vacant(entry) => entry.insert(Vec::new()),
}.push(dst);
}
}
+use std::sync::mpsc::Sender;
+
use util::{CargoResult, Fresh, Dirty, Freshness};
pub struct Job { dirty: Work, fresh: Work }
use std::collections::hash_map::HashMap;
use std::collections::hash_map::Entry::{Occupied, Vacant};
use std::sync::TaskPool;
+use std::sync::mpsc::{channel, Sender, Receiver};
use term::color::YELLOW;
use core::{Package, PackageId, Resolve, PackageSet};
///
/// Each build step for a package is registered with one of these stages, and
/// each stage has a vector of work to perform in parallel.
-#[deriving(Hash, PartialEq, Eq, Clone, PartialOrd, Ord, Show, Copy)]
+#[derive(Hash, PartialEq, Eq, Clone, PartialOrd, Ord, Show, Copy)]
pub enum Stage {
Start,
BuildCustomBuild,
// Record the freshness state of this package as dirty if any job is
// dirty or fresh otherwise
let fresh = jobs.iter().fold(Fresh, |f1, &(_, f2)| f1.combine(f2));
- match self.state.entry(pkg.get_package_id()) {
+ match self.state.entry(&pkg.get_package_id()) {
Occupied(mut entry) => { *entry.get_mut() = entry.get().combine(fresh); }
- Vacant(entry) => { entry.set(fresh); }
+ Vacant(entry) => { entry.insert(fresh); }
};
// Add the package to the dependency graph
// Now that all possible work has been scheduled, wait for a piece
// of work to finish. If any package fails to build then we stop
// scheduling work as quickly as possibly.
- let (id, stage, fresh, result) = self.rx.recv();
+ let (id, stage, fresh, result) = self.rx.recv().unwrap();
info!(" end: {} {}", id, stage);
let id = *self.state.keys().find(|&k| *k == &id).unwrap();
self.active -= 1;
let id = id.clone();
let (desc_tx, desc_rx) = channel();
self.pool.execute(move|| {
- my_tx.send((id, stage, fresh, job.run(fresh, desc_tx)));
+ my_tx.send((id, stage, fresh, job.run(fresh, desc_tx))).unwrap();
});
// only the first message of each job is processed
- match desc_rx.recv_opt() {
+ match desc_rx.recv() {
Ok(msg) => running.push(msg),
Err(..) => {}
}
// If no work was scheduled, make sure that a message is actually send
// on this channel.
if njobs == 0 {
- self.tx.send((id, stage, fresh, Ok(())));
+ self.tx.send((id, stage, fresh, Ok(()))).unwrap();
}
// Print out some nice progress information
use std::cell::RefCell;
use std::collections::HashSet;
use std::io::fs::PathExtensions;
-use std::io::{mod, fs, IoResult};
+use std::io::{self, fs, IoResult};
use std::mem;
use core::Package;
+use std::c_str::ToCStr;
use std::collections::{HashSet, HashMap};
use std::dynamic_lib::DynamicLibrary;
-use std::io::{fs, USER_RWX};
-use std::io::fs::PathExtensions;
+use std::io::USER_RWX;
+use std::io::fs::{self, PathExtensions};
use std::sync::Arc;
use core::{SourceMap, Package, PackageId, PackageSet, Target, Resolve};
-use util::{mod, CargoResult, human, caused_human};
+use util::{self, CargoResult, human, caused_human};
use util::{Config, internal, ChainError, Fresh, profile, join_paths, Human};
use self::job::{Job, Work};
mod layout;
mod links;
-#[deriving(PartialEq, Eq, Hash, Show, Copy)]
+#[derive(PartialEq, Eq, Hash, Show, Copy)]
pub enum Kind { Host, Target }
-#[deriving(Default, Clone)]
+#[derive(Default, Clone)]
pub struct BuildConfig {
pub host: TargetConfig,
pub target: TargetConfig,
}
-#[deriving(Clone, Default)]
+#[derive(Clone, Default)]
pub struct TargetConfig {
pub ar: Option<String>,
pub linker: Option<String>,
let (freshness, dirty, fresh) =
try!(fingerprint::prepare_target(cx, pkg, target, kind));
- let dirty = Work::new(move |desc_tx: Sender<String>| {
+ let dirty = Work::new(move |desc_tx| {
try!(work.call(desc_tx.clone()));
dirty.call(desc_tx)
});
1 => pkg.get_manifest().get_build()[0].to_string(),
_ => format!("custom build commands"),
};
- let dirty = Work::new(move |desc_tx: Sender<String>| {
+ let dirty = Work::new(move |desc_tx| {
if desc.len() > 0 {
- desc_tx.send_opt(desc).ok();
+ desc_tx.send(desc).ok();
}
for cmd in build_cmds.into_iter() {
try!(cmd.call(desc_tx.clone()))
let exec_engine = cx.exec_engine.clone();
- Ok(Work::new(move |desc_tx: Sender<String>| {
- desc_tx.send_opt(p.to_string()).ok();
+ Ok(Work::new(move |desc_tx| {
+ desc_tx.send(p.to_string()).ok();
if first && !output.exists() {
try!(fs::mkdir(&output, USER_RWX).chain_error(|| {
internal("failed to create output directory for build command")
}
}
- desc_tx.send_opt(rustc.to_string()).ok();
+ desc_tx.send(rustc.to_string()).ok();
try!(exec_engine.exec(rustc).chain_error(|| {
human(format!("Could not compile `{}`.", name))
}));
let desc = rustdoc.to_string();
let exec_engine = cx.exec_engine.clone();
- Ok(Work::new(move |desc_tx: Sender<String>| {
- desc_tx.send(desc);
+ Ok(Work::new(move |desc_tx| {
+ desc_tx.send(desc).unwrap();
if primary {
try!(exec_engine.exec(rustdoc).chain_error(|| {
human(format!("Could not document `{}`.", name))
use core::Source;
use sources::PathSource;
-use ops::{mod, ExecEngine, ProcessEngine};
+use ops::{self, ExecEngine, ProcessEngine};
use util::{CargoResult, ProcessError};
pub struct TestOptions<'a> {
use std::io::File;
use rustc_serialize::{Encodable, Decodable};
-use toml::{mod, Encoder, Value};
+use toml::{self, Encoder, Value};
use core::{Resolve, resolver, Package, SourceId};
use util::CargoResult;
use core::{Package, PackageId, SourceId};
use core::registry::PackageRegistry;
-use core::resolver::{mod, Resolve, Method};
+use core::resolver::{self, Resolve, Method};
use ops;
use util::CargoResult;
-use std::fmt::{mod, Show, Formatter};
+use std::fmt::{self, Show, Formatter};
use std::hash::Hasher;
use std::hash::sip::SipHasher;
use std::mem;
-use url::{mod, Url};
+use url::{self, Url};
use core::source::{Source, SourceId};
use core::GitReference;
-use std::fmt::{mod, Show, Formatter};
+use std::fmt::{self, Show, Formatter};
use std::io::{USER_DIR};
use std::io::fs::{mkdir_recursive, rmdir_recursive, PathExtensions};
use rustc_serialize::{Encodable, Encoder};
use core::GitReference;
use util::{CargoResult, ChainError, human, ToUrl, internal};
-#[deriving(PartialEq, Clone)]
+#[derive(PartialEq, Clone)]
#[allow(missing_copy_implementations)]
pub struct GitRevision(git2::Oid);
/// GitRemote represents a remote repository. It gets cloned into a local
/// GitDatabase.
-#[deriving(PartialEq,Clone,Show)]
+#[derive(PartialEq,Clone,Show)]
pub struct GitRemote {
url: Url,
}
-#[deriving(PartialEq,Clone,RustcEncodable)]
+#[derive(PartialEq,Clone,RustcEncodable)]
struct EncodableGitRemote {
url: String,
}
repo: git2::Repository,
}
-#[deriving(RustcEncodable)]
+#[derive(RustcEncodable)]
pub struct EncodableGitDatabase {
remote: GitRemote,
path: String,
repo: git2::Repository,
}
-#[deriving(RustcEncodable)]
+#[derive(RustcEncodable)]
pub struct EncodableGitCheckout {
database: EncodableGitDatabase,
location: String,
use std::cmp;
-use std::fmt::{mod, Show, Formatter};
-use std::io::fs::{mod, PathExtensions};
+use std::fmt::{self, Show, Formatter};
+use std::io::fs::{self, PathExtensions};
use glob::Pattern;
use git2;
//! ...
//! ```
-use std::io::{mod, fs, File};
+use std::io::{self, fs, File};
use std::io::fs::PathExtensions;
use std::collections::HashMap;
updated: bool,
}
-#[deriving(RustcDecodable)]
+#[derive(RustcDecodable)]
pub struct RegistryConfig {
/// Download endpoint for all crates. This will be appended with
/// `/<crate>/<version>/download` and then will be hit with an HTTP GET
pub api: String,
}
-#[deriving(RustcDecodable)]
+#[derive(RustcDecodable)]
struct RegistryPackage {
name: String,
vers: String,
yanked: Option<bool>,
}
-#[deriving(RustcDecodable)]
+#[derive(RustcDecodable)]
struct RegistryDependency {
name: String,
req: String,
use std::collections::hash_map::{HashMap};
use std::collections::hash_map::Entry::{Occupied, Vacant};
use std::io;
-use std::io::fs::{mod, PathExtensions, File};
+use std::io::fs::{self, PathExtensions, File};
use std::string;
use rustc_serialize::{Encodable,Encoder};
}
}
-#[deriving(Eq, PartialEq, Clone, RustcEncodable, RustcDecodable, Copy)]
+#[derive(Eq, PartialEq, Clone, RustcEncodable, RustcDecodable, Copy)]
pub enum Location {
Project,
Global
}
-#[deriving(Eq,PartialEq,Clone,RustcDecodable)]
+#[derive(Eq,PartialEq,Clone,RustcDecodable)]
pub enum ConfigValue {
String(string::String, Path),
List(Vec<(string::String, Path)>),
(&CV::Table(ref mut old), CV::Table(ref mut new)) => {
let new = mem::replace(new, HashMap::new());
for (key, value) in new.into_iter() {
- match old.entry(key) {
+ match old.entry(&key) {
Occupied(mut entry) => { try!(entry.get_mut().merge(value)); }
- Vacant(entry) => { entry.set(value); }
+ Vacant(entry) => { entry.insert(value); }
};
}
}
///
/// A fresh package does not necessarily need to be rebuilt (unless a dependency
/// was also rebuilt), and a dirty package must always be rebuilt.
-#[deriving(PartialEq, Eq, Show, Copy)]
+#[derive(PartialEq, Eq, Show, Copy)]
pub enum Freshness {
Fresh,
Dirty,
let mut my_dependencies = HashSet::new();
for dep in key.dependencies(cx).into_iter() {
assert!(my_dependencies.insert(dep.clone()));
- let rev = match self.reverse_dep_map.entry(dep) {
+ let rev = match self.reverse_dep_map.entry(&dep) {
Occupied(entry) => entry.into_mut(),
- Vacant(entry) => entry.set(HashSet::new()),
+ Vacant(entry) => entry.insert(HashSet::new()),
};
assert!(rev.insert(key.clone()));
}
use std::error::{FromError, Error};
-use std::fmt::{mod, Show};
+use std::fmt::{self, Show};
use std::io::IoError;
use std::io::process::{ProcessOutput, ProcessExit, ExitStatus, ExitSignal};
use std::str;
pub type CliResult<T> = Result<T, CliError>;
-#[deriving(Show)]
+#[derive(Show)]
pub struct CliError {
pub error: Box<CargoError>,
pub unknown: bool,
}
pub fn link(&mut self, node: N, child: N) {
- match self.nodes.entry(node) {
+ match self.nodes.entry(&node) {
Occupied(entry) => entry.into_mut(),
- Vacant(entry) => entry.set(HashSet::new()),
+ Vacant(entry) => entry.insert(HashSet::new()),
}.insert(child);
}
-use std::fmt::{mod, Show, Formatter};
+use std::fmt::{self, Show, Formatter};
use std::os;
-use std::c_str::CString;
+use std::c_str::{CString, ToCStr};
use std::io::process::{Command, ProcessOutput, InheritFd};
use std::collections::HashMap;
use util::{CargoResult, ProcessError, process_error};
-#[deriving(Clone,PartialEq)]
+#[derive(Clone,PartialEq)]
pub struct ProcessBuilder {
program: CString,
args: Vec<CString>,
}
}
- pub fn finish(&mut self) -> [u8, ..32] {
+ pub fn finish(&mut self) -> [u8; 32] {
unsafe {
- let mut ret = [0u8, ..32];
+ let mut ret = [0u8; 32];
let mut out = 0;
let n = EVP_DigestFinal_ex(self.ctx, ret.as_mut_ptr(), &mut out);
assert_eq!(n, 1);
})
}
- pub fn finish(&mut self) -> [u8, ..32] {
- let mut ret = [0u8, ..32];
+ pub fn finish(&mut self) -> [u8; 32] {
+ let mut ret = [0u8; 32];
let mut len = ret.len() as libc::DWORD;
call!(unsafe {
CryptGetHashParam(self.hcrypthash, HP_HASHVAL, ret.as_mut_ptr(),
-use url::{mod, Url, UrlParser};
+use url::{self, Url, UrlParser};
pub trait ToUrl {
fn to_url(self) -> Result<Url, String>;
use std::collections::HashMap;
use std::fmt;
-use std::io::fs::{mod, PathExtensions};
+use std::io::fs::{self, PathExtensions};
use std::os;
use std::slice;
use std::str;
///
/// This structure is used to hold references to all project files that are relevant to cargo.
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct Layout {
root: Path,
lib: Option<Path>,
* TODO: Make all struct fields private
*/
-#[deriving(RustcDecodable)]
+#[derive(RustcDecodable)]
pub enum TomlDependency {
Simple(String),
Detailed(DetailedTomlDependency)
}
-#[deriving(RustcDecodable, Clone, Default)]
+#[derive(RustcDecodable, Clone, Default)]
pub struct DetailedTomlDependency {
version: Option<String>,
path: Option<String>,
default_features: Option<bool>,
}
-#[deriving(RustcDecodable)]
+#[derive(RustcDecodable)]
pub struct TomlManifest {
package: Option<Box<TomlProject>>,
project: Option<Box<TomlProject>>,
target: Option<HashMap<String, TomlPlatform>>,
}
-#[deriving(RustcDecodable, Clone, Default)]
+#[derive(RustcDecodable, Clone, Default)]
pub struct TomlProfiles {
test: Option<TomlProfile>,
doc: Option<TomlProfile>,
release: Option<TomlProfile>,
}
-#[deriving(RustcDecodable, Clone, Default)]
+#[derive(RustcDecodable, Clone, Default)]
#[allow(missing_copy_implementations)]
pub struct TomlProfile {
opt_level: Option<uint>,
rpath: Option<bool>,
}
-#[deriving(RustcDecodable)]
+#[derive(RustcDecodable)]
pub enum ManyOrOne<T> {
Many(Vec<T>),
One(T),
}
}
-#[deriving(RustcDecodable)]
+#[derive(RustcDecodable)]
pub struct TomlProject {
name: String,
version: TomlVersion,
}
// TODO: deprecated, remove
-#[deriving(RustcDecodable)]
+#[derive(RustcDecodable)]
pub enum BuildCommand {
Single(String),
Multiple(Vec<String>)
Ok(())
}
-#[deriving(RustcDecodable, Show, Clone)]
+#[derive(RustcDecodable, Show, Clone)]
struct TomlTarget {
name: String,
crate_type: Option<Vec<String>>,
harness: Option<bool>,
}
-#[deriving(RustcDecodable, Clone)]
+#[derive(RustcDecodable, Clone)]
enum PathValue {
String(String),
Path(Path),
}
/// Corresponds to a `target` entry, but `TomlTarget` is already used.
-#[deriving(RustcDecodable)]
+#[derive(RustcDecodable)]
struct TomlPlatform {
dependencies: Option<HashMap<String, TomlDependency>>,
}
log!(4, "normalizing toml targets; lib={}; bin={}; example={}; test={}, benches={}",
libs, bins, examples, tests, benches);
- #[deriving(Copy)]
+ #[derive(Copy)]
enum TestDep { Needed, NotNeeded }
fn merge(profile: Profile, toml: &Option<TomlProfile>) -> Profile {
path = "lib.rs"
[dependencies]
-curl = "0.1.0"
-rustc-serialize = "0.1.1"
+curl = "0.1"
+rustc-serialize = "0.2"
+#![feature(old_orphan_check)]
+
extern crate curl;
extern crate "rustc-serialize" as rustc_serialize;
use std::fmt;
-use std::io::{mod, fs, MemReader, MemWriter, File};
+use std::io::{self, fs, MemReader, MemWriter, File};
use std::collections::HashMap;
use std::io::util::ChainedReader;
use std::result;
pub type Result<T> = result::Result<T, Error>;
-#[deriving(PartialEq, Copy)]
+#[derive(PartialEq, Copy)]
pub enum Auth {
Authorized,
Unauthorized
Io(io::IoError),
}
-#[deriving(RustcDecodable)]
+#[derive(RustcDecodable)]
pub struct Crate {
pub name: String,
pub description: Option<String>,
pub max_version: String
}
-#[deriving(RustcEncodable)]
+#[derive(RustcEncodable)]
pub struct NewCrate {
pub name: String,
pub vers: String,
pub repository: Option<String>,
}
-#[deriving(RustcEncodable)]
+#[derive(RustcEncodable)]
pub struct NewCrateDependency {
pub optional: bool,
pub default_features: bool,
pub kind: String,
}
-#[deriving(RustcDecodable)]
+#[derive(RustcDecodable)]
pub struct User {
pub id: uint,
pub login: String,
pub name: Option<String>,
}
-#[deriving(RustcDecodable)] struct R { ok: bool }
-#[deriving(RustcDecodable)] struct ApiErrorList { errors: Vec<ApiError> }
-#[deriving(RustcDecodable)] struct ApiError { detail: String }
-#[deriving(RustcEncodable)] struct OwnersReq<'a> { users: &'a [&'a str] }
-#[deriving(RustcDecodable)] struct Users { users: Vec<User> }
-#[deriving(RustcDecodable)] struct Crates { crates: Vec<Crate> }
+#[derive(RustcDecodable)] struct R { ok: bool }
+#[derive(RustcDecodable)] struct ApiErrorList { errors: Vec<ApiError> }
+#[derive(RustcDecodable)] struct ApiError { detail: String }
+#[derive(RustcEncodable)] struct OwnersReq<'a> { users: &'a [&'a str] }
+#[derive(RustcDecodable)] struct Users { users: Vec<User> }
+#[derive(RustcDecodable)] struct Crates { crates: Vec<Crate> }
impl Registry {
pub fn new(host: String, token: Option<String>) -> Registry {
use cargo::core::dependency::Kind::Development;
use cargo::core::{Dependency, PackageId, Summary, Registry};
use cargo::util::{CargoResult, ToUrl};
-use cargo::core::resolver::{mod, Method};
+use cargo::core::resolver::{self, Method};
fn resolve<R: Registry>(pkg: PackageId, deps: Vec<Dependency>,
registry: &mut R)
-use std::io::{mod, fs, File};
+use std::io::{self, fs, File};
use url::Url;
use git2;
+use std::c_str::ToCStr;
use std::error::Error;
-use std::fmt::{mod, Show};
-use std::io::fs::{mod, PathExtensions};
+use std::fmt::{self, Show};
+use std::io::fs::{self, PathExtensions};
use std::io::process::{ProcessOutput};
use std::io;
use std::os;
use std::path::{Path,BytesContainer};
-use std::str::{mod, Str};
+use std::str::{self, Str};
use url::Url;
use hamcrest as ham;
*
*/
-#[deriving(PartialEq,Clone)]
+#[derive(PartialEq,Clone)]
struct FileBuilder {
path: Path,
body: String
}
}
-#[deriving(PartialEq,Clone)]
+#[derive(PartialEq,Clone)]
struct SymlinkBuilder {
dst: Path,
src: Path
}
}
-#[deriving(PartialEq,Clone)]
+#[derive(PartialEq,Clone)]
pub struct ProjectBuilder {
name: String,
root: Path,
*
*/
-#[deriving(Clone)]
+#[derive(Clone)]
struct Execs {
expect_stdout: Option<String>,
expect_stdin: Option<String>,
second: I2,
}
-impl<T, I1: Iterator<T>, I2: Iterator<T>> Iterator<(Option<T>, Option<T>)> for ZipAll<T, I1, I2> {
+impl<T, I1: Iterator<Item=T>, I2: Iterator<Item=T>> Iterator for ZipAll<T, I1, I2> {
+ type Item = (Option<T>, Option<T>);
fn next(&mut self) -> Option<(Option<T>, Option<T>)> {
let first = self.first.next();
let second = self.second.next();
}
}
-fn zip_all<T, I1: Iterator<T>, I2: Iterator<T>>(a: I1, b: I2) -> ZipAll<T, I1, I2> {
+fn zip_all<T, I1: Iterator<Item=T>, I2: Iterator<Item=T>>(a: I1, b: I2) -> ZipAll<T, I1, I2> {
ZipAll {
first: a,
second: b
}
}
-#[deriving(Clone)]
+#[derive(Clone)]
struct ShellWrites {
expected: String
}
use std::io::IoResult;
-use std::io::fs::{mod, PathExtensions};
-use std::sync::atomic;
+use std::io::fs::{self, PathExtensions};
+use std::sync::atomic::{AtomicUint, ATOMIC_UINT_INIT, Ordering};
use std::{io, os};
use cargo::util::realpath;
static CARGO_INTEGRATION_TEST_DIR : &'static str = "cit";
-static NEXT_ID: atomic::AtomicUint = atomic::INIT_ATOMIC_UINT;
-thread_local!(static TASK_ID: uint = NEXT_ID.fetch_add(1, atomic::SeqCst));
+static NEXT_ID: AtomicUint = ATOMIC_UINT_INIT;
+thread_local!(static TASK_ID: uint = NEXT_ID.fetch_add(1, Ordering::SeqCst));
pub fn root() -> Path {
let path = os::self_exe_path().unwrap()
-use std::io::{mod, fs, File};
+use std::io::{self, fs, File};
use flate2::CompressionLevel::Default;
use flate2::writer::GzEncoder;
-use std::io::fs::{mod, PathExtensions};
+use std::io::fs::{self, PathExtensions};
use std::io;
use std::io::{USER_RWX, File};
use std::os;
-use std::io::{mod, fs, TempDir, File};
+use std::io::{self, fs, TempDir, File};
use std::os;
use std::path;
fn main() { println!("{}, {}!", world::get_goodbye(), world::get_world()); }
"#);
- assert_that(p.cargo_process("test"), execs());
+ assert_that(p.cargo_process("test"), execs().with_status(0));
assert_that(process(p.bin("examples/hello")).unwrap(),
execs().with_stdout("Hello, World!\n"));
assert_that(process(p.bin("examples/goodbye")).unwrap(),
use support::{project, execs, main_file, cargo_dir};
use support::{COMPILING, RUNNING};
-use support::paths::{mod, PathExt};
+use support::paths::{self, PathExt};
use hamcrest::{assert_that, existing_file};
use cargo;
use cargo::util::{process};
"#);
assert_that(p.cargo_process("build"),
- execs().with_stdout(format!("{} baz v0.5.0 ({})\n\
+ execs().with_status(0)
+ .with_stdout(format!("{} baz v0.5.0 ({})\n\
{} bar v0.5.0 ({})\n\
{} foo v0.5.0 ({})\n",
COMPILING, p.url(),
assert_that(
cargo::util::process(p.bin("foo")).unwrap(),
- execs().with_stdout("test passed\n"));
+ execs().with_stdout("test passed\n").with_status(0));
println!("cleaning");
assert_that(p.process(cargo_dir().join("cargo")).arg("clean"),
- execs().with_stdout(""));
+ execs().with_stdout("").with_status(0));
println!("building baz");
assert_that(p.process(cargo_dir().join("cargo")).arg("build")
.arg("-p").arg("baz"),
- execs().with_stdout(format!("{} baz v0.5.0 ({})\n",
+ execs().with_status(0)
+ .with_stdout(format!("{} baz v0.5.0 ({})\n",
COMPILING, p.url())));
println!("building foo");
assert_that(p.process(cargo_dir().join("cargo")).arg("build")
.arg("-p").arg("foo"),
- execs().with_stdout(format!("{} bar v0.5.0 ({})\n\
+ execs().with_status(0)
+ .with_stdout(format!("{} bar v0.5.0 ({})\n\
{} foo v0.5.0 ({})\n",
COMPILING, p.url(),
COMPILING, p.url())));
-use std::io::{mod, fs, File, MemReader};
+use std::io::{self, fs, File, MemReader};
use flate2::reader::GzDecoder;
use tar::Archive;
-use std::io::{mod, fs, File};
+use std::io::{self, fs, File};
use cargo::util::process;
use support::{project, execs, cargo_dir};
use support::{UPDATING, DOWNLOADING, COMPILING, PACKAGING, VERIFYING};
-use support::paths::{mod, PathExt};
+use support::paths::{self, PathExt};
use support::registry as r;
use support::git;
-use std::io::{mod, fs, File};
+use std::io::{self, fs, File};
use url::Url;
use std::io::{MemWriter, IoResult, ChanReader, ChanWriter};
+use std::sync::mpsc::channel;
use term::{Terminal, TerminfoTerminal, color};
use hamcrest::{assert_that};
-#![feature(macro_rules)]
+#![feature(macro_rules, associated_types)]
#![feature(phase)]
#![deny(warnings)]